package homework.homework02;

/*
 *      day01的作业第二题
 *
 * */

//要符合封装的规范
public class Animal {
    private String name;
    private String color;
    private double price;

    public Animal() {
    }

    public Animal(String name, String color, double price) {
        this.name = name;
        this.color = color;
        this.price = price;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }
    //行为:吃饭
    public void eat(){
        System.out.println(name + "在吃饭");
    }

    //skill
    public void skill(){
        System.out.println("各自有各自的特性");
    }


    //重写toString()方法


    @Override
    public String toString() {
        return "Animal{" +
                "name='" + name + '\'' +
                ", color='" + color + '\'' +
                ", price=" + price +
                '}';
    }
}
